

//---------- Interface de la tache <tJournal> (fichier tJournal.h)--

#ifndef __tJournal_H__
#define __tJournal_H__

#include <msgQLib.h>
#include <stdint.h>
#include "time.h"

/*********************** TYPE DEFINITION ********************************/
typedef int8_t LOG_TYPE;

/* Structure of a log entry */
typedef struct 
{
        time_t time;
        LOG_TYPE type;
        char task[32];
        char msg[255];
        
} LOG_ENTRY;

/*********************** CONST DEFINITION *******************************/
#define MAX_LOG_ENTRIES			32
#define END_OF_LINE				"\r\n"

#define LOG_TYPE_NORMAL         1
#define LOG_TYPE_WARNING        2
#define LOG_TYPE_ERROR          3
#define LOG_TYPE_STOP           4
#ifdef __DEBUG
#define LOG_TYPE_DEBUG          5
#endif

#define LOG_FILE  "/tgtsvr/log.txt"

/************************ PUBLIC VARIABLES ******************************/
MSG_Q_ID msg_log;

/************************ PUBLIC FUNCTIONS ******************************/
/* Journal task routine which allow to handle every log I/O operations */
void tJournal();
/* Add a log entry */
void add_log( LOG_TYPE type, const char* task, const char* msg );

#endif
